define(['app'], function(app) {
	'use strict';

	//实例化方法
	var factory = function(Http) {
		function get_data_invoiceEdit(result) {
			if(false) {
				result = '{"success": true,"msg": "","result": {"id": "001"},"session": "7311da98bd0f18eb15a96bcb263f4153"}';
				return JSON.parse(result);
			} else {
				return result;
			}
		};
		function get_data_invoiceDetail(result){
			if(false){
				result = '{"success":true,"msg":"","result":{"company_name":"世达五金有限公司","tax_no":"tax_1234567890","address":"中华路23号","phone":13989899800,"bank":"中国银行","bank_no":1234455677,"status":"审核中"},"session":"7311da98bd0f18eb15a96bcb263f4153"}';
				return JSON.parse(result);
			}else
			return result;
		}
		
		//返回信息
		return {
			//发票新增
			invoice_edit: function(company_name,tax_no,address,phone,bank,bank_no,callback) {
				var updateParams = new Object();
				updateParams.company_name = company_name;
				updateParams.tax_no = tax_no;
				updateParams.address = address;
				updateParams.phone = phone;
				updateParams.bank = bank;
				updateParams.bank_no = bank_no;
				updateParams = JSON.stringify(updateParams);
				Http.post({
					method: 'member.invoice.edit',
					updateParams: updateParams
				}, function(result) {
					if(callback)
						callback(get_data_invoiceEdit(result));
				}, function(e) {

				}, function() {

				});
			},
			//详情
			invoice_detail:function(callback){
				Http.post({
					method:'member.invoice.detail',
				},function(result){
					if(callback)
						callback(get_data_invoiceDetail(result).result);
				},function(e){
					
				},function(){
					
				})
			}
		};
	}

	factory.$inject = ['Http'];
	return app.registerService("T_address_add_fp", factory);
});